package 类与对象.多态.向上向下转型;

public class Main {
    public static void main(String[] args) {
        //向上转型 父类引用指向了子类的对象
        Animal animal = new Cat();
        Object obj = new Cat();

        animal.run();
        animal.eat();
        animal.sleep();
        animal.show();

        //向下转型
        Cat cat = (Cat) animal;
        cat.catchMouse();

        Dog dog = (Dog) animal;

    }
}
